<template>
	<view class="detail-view">

		<th-titlebar ref="titleBar" :commonTitle="true" title="处理问题">
		</th-titlebar>
		<th-cell :required="false" :disabled="true" title="提交人" :loge="true"
			:value="detailInfo.commitUserName"></th-cell>
		<th-cell :required="false" :disabled="true" title="联系电话" :loge="true"
			:value="detailInfo.commitUserPhone"></th-cell>
		<th-cell :required="false" :disabled="true" title="代表姓名" :loge="true" :value="detailInfo.toUserName"></th-cell>
		<th-cell :required="false" :disabled="true" title="所属镇街/市直代表小组" :loge="true"
			:value="detailInfo.stationName"></th-cell>
		<view class="line-item2"></view>
		<th-cell :required="false" :disabled="true" title="问题地点" :loge="true" :value="detailInfo.address"></th-cell>
		<th-cell :required="false" :disabled="true" title="问题标题" :loge="true" :value="detailInfo.title"></th-cell>
		<view class="desc-content">
			<view style="word-break: break-all;">{{detailInfo.content}}</view>
			<view style="margin-top: 10rpx;" v-for="(item,index) in fileListMedia" :key="index">
				<th-file :file="item" @priview="priview"></th-file>
			</view>
		</view>
		<!-- 处理流程  -->
		<block v-for="(item,index) in approveList" :key="index">
			<view class="line-item2"></view>
			<th-process-item :stepData="item"></th-process-item>
		</block>


		<!-- XXX 代表-待处理 detailInfo.nodeStatus == 1 tb-process-->
		<block v-if="(detailInfo.nodeStatus == 1||detailInfo.nodeStatus == 11)&&$sysBtns('tb-process')">
			<view class="line-item2"></view>
			<view class="title-view-box">问题处理</view>
			<th-cell title="问题类型" :value="formNew.typeName" :required="false" :disabled="true" :showArrow="true"
				placeHolder="请选择" @contentTap="problemType()"></th-cell>

			<th-cell :required="false" :disabled="true" title="处理类型" :loge="true"
				:value="detailInfo.nodeStatus == 11?approveList[0].approveFlagName:''"></th-cell>
			<!-- 处理类型 -->
			<view v-if="detailInfo.nodeStatus == 1" class="deal-type-box" style="padding: 0 60rpx;">
				<u-radio-group v-model="formNew.approveFlag" active-color="rgba(51, 150, 251, 1)">
					<u-radio v-for="(item, index) in dealList" label-size="18" labelSize="18" :key="index" :name="item.value">
						{{item.name}}
					</u-radio>
				</u-radio-group>
			</view>
			<view v-if="detailInfo.nodeStatus == 1" class="common-title">处理备注</view>
			<view class="text-area-box">
				<view v-if="detailInfo.nodeStatus == 11" class="desc-cotent" style="padding-left: 0;padding-right: 0;">
					{{approveList[0].content}}
				</view>
				<textarea v-if="detailInfo.nodeStatus == 1" v-model="formNew.content"
					style="z-index: 1;line-height: 38rpx;text-align: justify;width: 100%;" placeholder="请输入备注内容"
					placeholder-style="fontSize: 34rpx;fontWeight: 500;color: #999999"></textarea>
			</view>

			<th-cell v-if="detailInfo.nodeStatus == 11" :showLtop="true" :required="false" :disabled="true" title="处理人"
				:loge="true" :value="approveList[0].approveUserName"></th-cell>
			<th-cell v-if="detailInfo.nodeStatus == 11" :required="false" :disabled="true" title="处理时间" :loge="true"
				:value="approveList[0].approveTime"></th-cell>
			<view v-if="detailInfo.nodeStatus == 1" class="bottom-btn-box" style="position: relative;">
				<view class="submit-btn" @tap="approve()">提交</view>
			</view>


		</block>
		<!-- XXX 代表-代表自行解决 detailInfo.nodeStatus == 11  tb-process-->
		<block v-if="detailInfo.nodeStatus == 11&&$sysBtns('tb-process')">
			<view class="line-item2"></view>
			<view class="title-view-box">代表自行解决</view>
			<view class="text-area-box">
				<textarea v-model="formNew.content"
					style="z-index: 1;line-height: 38rpx;text-align: justify;width: 100%;" placeholder="请输入详情（必填）"
					placeholder-style="fontSize: 34rpx;fontWeight: 500;color: #999999"></textarea>
				<uni-file-upload ref="uniuploader" :type="['all', 'image', 'audio']" :limit="10"></uni-file-upload>
			</view>
			<view class="bottom-btn-box" style="position: relative;">
				<view class="submit-btn" @tap="approve()">提交</view>
			</view>
		</block>
		<!-- XXX 镇街、人代室-待确定  detailInfo.nodeStatus==7 tb-determined-->
		<block v-if=" detailInfo.nodeStatus==7&&$sysBtns('tb-determined')">
			<view class="line-item2"></view>
			<view class="title-view-box">镇街/人代室待确定</view>
			<th-cell :required="false" :disabled="true" title="处理类型" :loge="true"></th-cell>
			<!-- 处理类型 -->
			<view class="deal-type-box" style="justify-content: left;padding-left: 60rpx;padding-right: 60rpx;">


				<u-radio-group v-model="formNew.approveFlag" active-color="rgba(51, 150, 251, 1)">
					<u-radio v-for="(item, index) in dertemined" label-size="28" labelSize="28" :key="index" :name="item.value">
						{{item.name}}
					</u-radio>
				</u-radio-group>
			</view>
			<view class="common-title">处理备注</view>
			<view class="text-area-box">
				<textarea v-model="formNew.content"
					style="z-index: 1;line-height: 38rpx;text-align: justify;width: 100%;" placeholder="请输入备注内容"
					placeholder-style="fontSize: 34rpx;fontWeight: 500;color: #999999"></textarea>
			</view>
			<view class="bottom-btn-box" style="position: relative;">
				<view class="submit-btn" @tap="approve()">提交</view>
			</view>

		</block>
		<!-- XXX 镇街处理 detailInfo.nodeStatus==2  t-process-bystreet -->
		<block v-if=" detailInfo.nodeStatus==2&&$sysBtns('t-process-bystreet')">
			<view class="line-item2"></view>
			<view class="title-view-box">镇街处理</view>
			<!-- <th-cell title="问题类型" :value="formNew.typeName" :required="false" :disabled="true" :showArrow="true"
				placeHolder="请选择" @contentTap="problemType()"></th-cell> -->
			<th-cell :required="false" :disabled="true" title="处理类型" :loge="true"></th-cell>
			<!-- 处理类型 -->
			<view class="deal-type-box" style="justify-content: left;padding-left: 60rpx;padding-right: 60rpx;">

				<u-radio-group v-model="formNew.approveFlag" active-color="rgba(51, 150, 251, 1)">
					<u-radio v-for="(item, index) in streetZType" label-size="28" labelSize="28" :key="index" :name="item.value">
						{{item.name}}
					</u-radio>
				</u-radio-group>

			</view>
			<view class="common-title">处理备注</view>
			<view class="text-area-box">
				<textarea v-model="formNew.content"
					style="z-index: 1;line-height: 38rpx;text-align: justify;width: 100%;" placeholder="请输入备注内容"
					placeholder-style="fontSize: 34rpx;fontWeight: 500;color: #999999"></textarea>
			</view>
			<view class="bottom-btn-box" style="position: relative;">
				<view class="submit-btn" @tap="approve()">提交</view>
			</view>

		</block>
		<!-- XXX 人代室处理 detailInfo.nodeStatus==3  t-process-bygenmenroom -->
		<block v-if=" detailInfo.nodeStatus==3&&$sysBtns('t-process-bygenmenroom')">
			<view class="line-item2"></view>
			<view class="title-view-box">人代室处理</view>
			<!-- <th-cell title="问题类型" :value="formNew.typeName" :required="false" :disabled="true" :showArrow="true"
				placeHolder="请选择" @contentTap="problemType()"></th-cell> -->
			<view class="common-title">处理备注</view>
			<view class="text-area-box">
				<textarea v-model="formNew.content"
					style="z-index: 1;line-height: 38rpx;text-align: justify;width: 100%;" placeholder="请输入备注内容"
					placeholder-style="fontSize: 34rpx;fontWeight: 500;color: #999999"></textarea>
			</view>
			<view class="bottom-btn-box" style="position: relative;">
				<view class="submit-btn" @tap="approve()">提交</view>
			</view>

		</block>
		<!-- XXX 政府处理 detailInfo.nodeStatus==4  t-process-bygovement -->
		<block v-if="(detailInfo.nodeStatus==4||detailInfo.nodeStatus==5)&&$sysBtns('t-process-bygovement')">
			<view class="line-item2"></view>
			<view class="title-view-box">政府处理</view>
			<th-cell title="主办单位" :value="formNew.zbHandlerName" :required="true" :disabled="true" :showArrow="true"
				placeHolder="请点击选择" @contentTap="s1"></th-cell>
			<th-cell title="协办单位" :required="false" :disabled="true" :addLogo="true" :loge="true" :showArrow="false"
				placeHolder="" @contentTap="s2"></th-cell>

			<view v-if="coOrganizerList.length>0" class="coOrganizer-box">
				<!-- colorResource="#F8F8F8" -->
				<neo-labels :list="coOrganizerList" keyResource="deptName" colorResource="#F8F8F8"
					@del="del"></neo-labels>
			</view>


			<th-cell :showLtop="coOrganizerList.length>0?true:false" title="选择办理答复时间" :value="formNew.latestReplyTime"
				:required="false" :disabled="true" :showArrow="true" placeHolder="请点击时间"
				@contentTap="showTime"></th-cell>
			<view class="common-title">处理备注</view>
			<view class="text-area-box">

				<textarea v-model="formNew.content"
					style="z-index: 1;line-height: 38rpx;text-align: justify;width: 100%;" placeholder="请输入备注内容"
					placeholder-style="fontSize: 34rpx;fontWeight: 500;color: #999999"></textarea>
			</view>
			<view class="bottom-btn-box" style="position: relative;">
				<view class="submit-btn" @tap="approve()">提交</view>
			</view>

		</block>


		<!-- XXX （主办，协办）单位处理 detailInfo.nodeStatus==5  t-process-bygovement -->
		<block v-if="detailInfo.nodeStatus==5&&$sysBtns('t-process-bygovement-unit')">
			<view class="line-item2"></view>
			<view class="title-view-box">单位办理中</view>
			<view class="text-area-box">
				<textarea v-model="formNew.content"
					style="z-index: 1;line-height: 38rpx;text-align: justify;width: 100%;" placeholder="输入办理答复内容（必填）"
					placeholder-style="fontSize: 34rpx;fontWeight: 500;color: #999999"></textarea>
				<uni-file-upload ref="uniuploader" :type="['all', 'image', 'audio']" :limit="10"></uni-file-upload>
			</view>
			<view class="bottom-btn-box" style="position: relative;">
				<view class="submit-btn" @tap="reply()">提交</view>
			</view>

		</block>








		<u-select v-model="show" :list="list" labelName="dictName" valueName="dictValue"
			@confirm='confirmType'></u-select>
		<u-picker v-model="timeShow" mode="time" @confirm="tiemConfirm" :start-year="year" :start-month="month"
			:start-day="day"></u-picker>
		<!-- 主办单位 -->
		<select-tree ref="zbTree" :show="zbShow" :range="zbList" :selected="zbStr" rangeKey="deptName" :multiple="false"
			:selectParent="false" @confirm="treeConfirm($event, 'zb')" @cancel="treeCancel($event, 'zb')"></select-tree>
		<!-- 协办单位 -->
		<select-tree ref="xbTree" :show="xbShow" :range="xbList" :selected="xbStr" rangeKey="deptName"
			:selectParent="false" @confirm="treeConfirm($event, 'xb')" @cancel="treeCancel($event, 'xb')"></select-tree>


	</view>
</template>

<script>
	import uniFileUpload from '@/components/uni-all-uploader.vue';
	import uniParse from '@/components/uni-parse/parse.vue';
	import selectTree from '@/components/uni-select-tree.vue';

	import {
		mapState
	} from 'vuex';
	export default {
		components: {
			uniFileUpload,
			uniParse,
			selectTree,
		},
		data() {
			return {
				show: false,
				year: '2023', //当前年
				month: '4', //当前月
				day: '15', //当前日

				coOrganizerList: [], //协办单位

				zbIds: [],
				zbName: '',
				zbShow: false,
				zbList: [],
				zbStr: '',

				xbIds: [],
				xbName: '',
				xbShow: false,
				xbList: [],
				xbStr: '',

				fbIds: [],
				fbName: '',
				fbShow: false,
				fbList: [],
				fbStr: '',

				list: [],
				timeShow: false,
				approveList: [], //处理流程
				formNew: {
					problemId: "", //问题id
					approveFlag: 1, //处理类型 待处理(1代表自行解决 2转镇街/转人代室 3不予解决)；镇街处理(1镇街办理 2转人代室)；人代室处理(1转政府)；待确定(1确定 2退回)
					content: "", //处理备注
					zbHandler: "", //主办
					zbHandlerName: '', //主办单位
					xbHandler: "", //协办
					latestReplyTime: "", //答复截止时间
					type: '', //问题分类
					typeName: '', //问题分类名称
				}, //提交表单

				value: '代表自行解决',
				dealList: [{
					name: '代表自行解决',
					value: 1
				}, {
					name: '转镇街/人代室',
					value: 2
				}, {
					name: '不予接收',
					value: 3
				}],
				dertemined: [{
					name: '确定',
					value: 1
				}, {
					name: '退回',
					value: 2
				}],
				streetZType: [{
					name: '镇街办理',
					value: 1
				}, {
					name: '转人代室',
					value: 2
				}],
				proTypeList: [], //问题类型
				statusMap: {
					0: '所有',
					1: '待审核',
					2: '办理中',
					3: '已答复',
					4: '已办结',
					5: '不予受理'
				},

				handle: '',
				handleShow: false,
				handleList: [],

				type: '',
				typeShow: false,
				typeList: [],

				secType: '',
				secTypeShow: false,
				secTypeList: [],

				id: '',
				userId: '',
				status: '1',
				detailInfo: {},
				fileList1: [],
				fileList2: [],
				fileList3: [],
				form: {
					handleInfo: '',
					handleTime: '',
					handleResult: '',
					type: '',
					secType: '',
					yianId: '',
					jianyiId: ''
				},
				form1: {
					type: '',
					secType: '',
					finishInfo: '',
					finishTime: ''
				},
				rules: {
					type: [{
						required: true,
						message: '请选择审核类型',
						trigger: 'change'
					}],
					pass: [{
						required: true,
						message: '请选择办理意见',
						trigger: 'change'
					}],
					opinion: [{
						required: true,
						message: '请输入处理结果',
						trigger: 'change'
					}]
				},
				key: -1,
				play: false,
				detailInfo: undefined,
				fileListMedia: [],
			};
		},
		onLoad(option) {
			this.setDate()
			this.loadLogin();
			this.formNew.problemId = option.id;
			this.problemQuery(this.formNew.problemId)
			if (option.status) {
				this.status = option.status;
			}
			this.loadDict('problem_type', 'proTypeList');
			// this.loadDictType('masses_type', 'handleList');

			// this.loadData();
		},
		onReady() {
			// this.$refs.uForm.setRules(this.rules);
		},
		onHide() {
			this.$ttsOff();
		},
		onUnload() {
			this.$ttsOff();
			this.$store.commit('filePush', []);
		},
		computed: {
			...mapState(['userInfo', 'fileList'])
		},
		methods: {


			// 政府调整主协办单位
			change() {

				if (this.formNew.zbHandler == '') {
					this.$msg('请选择主办单位')
					return
				}
				this.formNew.xbHandler = ''
				this.coOrganizerList.forEach(item => {
					this.formNew.xbHandler += item.id + ','
				})
				let data = {
					problemId: this.formNew.problemId,
					zbHandler: this.formNew.zbHandler,
					xbHandler: this.formNew.xbHandler,
					replyContent: this.formNew.content,
					latestReplyTime: this.formNew.latestReplyTime,
					clientCode: this.$c.clientCode
				}
				this.$request('/problem/handler/change', data).then(result => {
					this.$msg(result.msg);
					uni.$emit('refresh', {
						label: '',
						value: '10'
					})
					this.back();

				})
			},


			//预览
			priview(item) {
				this.$showLine(item)
			},

			showTime() {
				this.timeShow = true
			},

			setDate() {
				let date = new Date()
				this.year = date.getFullYear()
				this.month = date.getMonth() + 1
				this.day = date.getDate()
				// console.log('日期：' + this.year + '-' + this.month + '-' + this.day)
			},

			// 办理答复
			reply() {
				if (this.formNew.content.length == 0) {
					this.$msg('请输入办理答复内容')
					return
				}

				let data = {
					problemId: this.formNew.problemId,
					replyContent: this.formNew.content,
					fileList: this.fileList,
					clientCode: this.$c.clientCode
				}
				this.$request('/problem/handler/reply', data).then(result => {
					this.$msg(result.msg);
					uni.$emit('refresh', {
						label: '',
						value: '10'
					})
					this.back();

				})
			},



			//审批
			approve() {

				if (this.detailInfo.nodeStatus == 4) {
					if (this.formNew.zbHandler == '') {
						this.$msg('请选择主办单位')
						return
					}
					this.formNew.xbHandler = ''
					this.coOrganizerList.forEach(item => {
						this.formNew.xbHandler += item.id + ','
					})

				} else if (this.detailInfo.nodeStatus == 5 && this.$sysBtns('t-process-bygovement')) {
					// 政府处理办理单位
					this.change()

					return
				}


				let data = {
					problemCirculRecord: this.formNew,
					fileList: this.fileList,
					clientCode: this.$c.clientCode
				}
				this.$request('/problem/approve', data).then(result => {
					this.$msg(result.msg);
					uni.$emit('refresh', {
						label: '',
						value: '10'
					})
					this.back();

				})
			},

			// 选择办理答复时间回调
			tiemConfirm(e) {
				// console.log('e:' + JSON.stringify(e))
				this.formNew.latestReplyTime = e.year + '-' + e.month + '-' + e.day
			},



			confirmType(e) {
				this.formNew.typeName = e[0].label
				this.formNew.type = e[0].value
			},
			s1() {
				this.zbShow = true
			},
			s2() {
				this.xbShow = true
			},

			del(index) {
				this.coOrganizerList.splice(index, 1)

			},


			// 主办单位
			loadHandler() {
				this.$request('/system/sys-dept/allHandler2', {
					clientCode: this.$c.clientCode,
					currentUserId: this.userId,
					sanshenFlag: '1'
				}).then((res) => {
					this.zbList = res.data;
					this.xbList = res.data;
					this.fbList = res.data;
					if (this.formNew.zbHandler != '') {
						this.cycleList(this.formNew.zbHandler, this.zbList, 'zb')
					}

					if (this.formNew.xbHandler != '') {
						let cos = this.formNew.xbHandler.split(',')
						cos.forEach(item => {
							this.cycleList(item, this.xbList, 'xb')
						})
					}
				});
			},
			// 递归找出主办、协办单位
			cycleList(id, list, type) {
				for (let index in list) {
					if (id == list[index].id) {
						// list[index].checked = true
						if (type == 'zb') {
							// this.treeConfirm([list[index]], 'zb');
							this.formNew.zbHandlerName = list[index].deptName
							break
						} else {
							this.coOrganizerList.push(list[index])
							// this.treeConfirm(this.coOrganizerList, 'xb');

						}
					}
					if (list[index].list != undefined) {
						this.cycleList(id, list[index].list, type)
					}
				}

			},

			// 问题类型
			problemType() {
				console.log('problemType')
				this.show = true
				this.list = this.proTypeList
			},

			problemQuery(id) {
				this.$request(this.$c.api.problemQuery, {
					id: id
				}).then(result => {

					this.detailInfo = result.data.problem
					// 无转处理，默认置为空
					if (this.detailInfo.nodeStatus != 1 && this.detailInfo.nodeStatus != 7 && this.detailInfo
						.nodeStatus != 2 && this.detailInfo.nodeStatus != 3) {
						this.formNew.approveFlag = ''
					}


					if (result.data.approveList != undefined) {
						this.approveList = result.data.approveList
						if (this.detailInfo.nodeStatus == 5 && this.$sysBtns('t-process-bygovement') && this
							.approveList.length > 0) {
							//办理中-政府-变更执行单位
							//主办单位
							this.formNew.zbHandler = this.approveList[this.approveList.length - 1].zbHandler !=
								undefined ? this.approveList[this.approveList.length - 1].zbHandler : ''
							// 协办单位
							this.formNew.xbHandler = this.approveList[this.approveList.length - 1].xbHandler !=
								undefined ? this.approveList[this.approveList.length - 1].xbHandler : ''
							//答复时间
							this.formNew.latestReplyTime = this.approveList[this.approveList.length - 1]
								.latestReplyTime != undefined ? this.approveList[this.approveList.length - 1]
								.latestReplyTime : ''
							//处理备注
							this.formNew.content = this.approveList[this.approveList.length - 1].content !=
								undefined ? this.approveList[this.approveList.length - 1].content : ''
						}

					}
					if (result.data.fileList != undefined)
						this.fileListMedia = result.data.fileList

					// 政府处理查询协办单位
					if ((this.detailInfo.nodeStatus == 4 || this.detailInfo.nodeStatus == 5) && this.$sysBtns(
							't-process-bygovement')) {
						this.loadHandler()

					}




				})
			},
			loadLogin() {
				if (this.userInfo.sysUser) {
					this.clientCode = this.userInfo.sysUser.clientCode;
					this.userId = this.userInfo.sysUser.id;
					this.roleCodes = this.userInfo.roleCodes.join(',');

					let time = this.$writeCurrentDate();
					this.form.handleTime = time.year + '-' + time.month + '-' + time.date;
					this.form1.finishTime = time.year + '-' + time.month + '-' + time.date;
				} else {
					this.$logout();
				}
			},
			loadDictType(type, list) {
				this.$request('/system/sys-dict/dictList', {
					clientCode: this.$c.clientCode,
					sysDict: {
						dictType: type,
						remark: 'type'
					}
				}).then((res) => {
					if (!res.data) {
						return false;
					}
					this[list] = [];
					res.data.forEach((item) => {
						this[list].push({
							name: item.dictValue,
							value: item.dictValue,
							label: item.dictName
						});
					});
				});
			},
			loadDict(type, list, value) {
				this.$request('/system/sys-dict/dictList', {
					clientCode: this.$c.clientCode,
					sysDict: {
						dictType: type
					}
				}).then((res) => {
					// console.log('res：' + JSON.stringify(res))
					if (!res.data) {
						return false;
					}
					this[list] = res.data;
					// res.data.forEach((item) => {
					// 	this[list].push({
					// 		name: item.dictValue,
					// 		value: item.dictValue,
					// 		label: item.dictName
					// 	});
					// 	if (value && value == item.dictValue) {
					// 		this.secType = item.dictName;
					// 	}
					// });
				});
			},
			loadData() {

				return
				this.$request('/question/masses/query/' + this.id, {
					id: this.id,
					userId: this.userId
				}).then((res) => {
					if (!res.data) {
						this.$msg('暂无数据');
						return false;
					}
					this.fileList1 = res.data.fileList || [];
					this.fileList2 = res.data.fileList2 || [];
					this.detailInfo = res.data.masses;

					if (this.detailInfo.type) {
						this.type = this.detailInfo.typeName;
						this.form.type = this.detailInfo.type;
						this.form1.type = this.detailInfo.type;
						this.loadDict('question_type_' + this.detailInfo.type, 'secTypeList');
					}
					if (this.detailInfo.secType) {
						this.secType = this.detailInfo.secTypeName;
						this.form.secType = this.detailInfo.secType;
						this.form1.secType = this.detailInfo.secType;
					}
				});
			},
			typeConfirm(e) {
				this.type = e[0].label;
				this.form.type = e[0].value;
				this.form1.type = e[0].value;
				this.loadDict('question_type_' + e[0].value, 'secTypeList');
				this.secType = '';
				this.form.secType = '';
				this.form1.secType = '';
			},
			secTypeConfirm(e) {
				this.secType = e[0].label;
				this.form.secType = e[0].value;
				this.form1.secType = e[0].value;
			},
			handleConfirm(e) {
				this.handle = e[0].label;
				this.form.handleResult = e[0].value;
			},
			handleGroupChange(e) {
				this.handle = e;
				this.form.handleResult = e;
				console.log(e);
				if (e == '2') {
					uni.navigateTo({
						url: '/pagesB/proposal/add?id=' + this.id + '&type=clue'
					});
				}
				if (e == '3') {
					uni.navigateTo({
						url: '/pagesB/propose/add?id=' + this.id + '&type=clue'
					});
				}
			},
			proposalChange(e) {
				this.form.jianyiId = e;
			},
			proposeChange(e) {
				this.form.yianId = e;
			},
			confirm() {
				let data = {};
				data = {
					userId: this.userId,
					role: this.roleCodes,
					masses: {
						id: this.detailInfo.id,
						handleUser: this.userId,
						...this.form
					}
				};

				if (!this.form.handleResult) {
					this.$msg('请选择处理方式');
					return false;
				}

				if (this.form.handleResult == '2' && !this.form.jianyiId) {
					this.$msg('请提交建议');
					return false;
				}

				if (this.form.handleResult == '3' && !this.form.yianId) {
					this.$msg('请提交议案');
					return false;
				}

				let url = '/question/masses/handle';
				this.$request(url, data, {
					load: true
				}).then((res) => {
					this.$msg(res.msg);
					this.navigateBack();
				});
			},
			confirm1() {
				let data = {};
				data = {
					userId: this.userId,
					role: this.roleCodes,
					fileList2: this.fileList,
					masses: {
						id: this.detailInfo.id,
						finishUser: this.userId,
						...this.form1
					}
				};

				if (!this.form1.finishInfo) {
					this.$msg('请输入办理结果');
					return false;
				}

				let url = '/question/masses/finish';
				this.$request(url, data, {
					load: true
				}).then((res) => {
					this.$msg(res.msg);
					this.back();
				});
			},
			back(e) {
				this.navigateBack();
			},
			navigateBack(e) {
				setTimeout(() => {
					let pre = this.$prePage();
					if (pre && pre.loadData) {
						pre.loadData('refresh');
					}
					uni.navigateBack();
				}, 500);
			},
			call(e) {
				uni.makePhoneCall({
					phoneNumber: e.phone
				});
			},
			onTts() {
				let text = this.detailInfo.questionTitle || '';
				text += '，时间：' + this.detailInfo.createTimeStr;
				text += '，联系电话：' + this.detailInfo.phone;
				text += '，问题编号：' + this.detailInfo.questionCode;
				text += '，发生地点：' + this.detailInfo.questionPlace;
				text += '，' + this.detailInfo.content;
				this.$tts(text, this, 500);
			},
			previewImage(idx, images) {
				uni.previewImage({
					current: idx,
					urls: images
				});
			},
			treeConfirm(e, type) {

				if (!e || e.length == 0) {
					this[type + 'Show'] = false;
					this[type + 'Name'] = '';
					this[type + 'Ids'] = [];
					return false;
				}
				if (type == 'zb') {
					//主办单位
					// this[type + 'Ids'] = [e[0].id];
					// this[type + 'Name'] = e[0].deptName;
					this.formNew.zbHandler = e[0].id;
					this.formNew.zbHandlerName = e[0].deptName;
				} else {
					this.coOrganizerList = e

					//协办单位
					this[type + 'Ids'] = [];
					let names = [];
					let i = 0;
					e.forEach((item) => {
						this[type + 'Ids'].push(item.id);
						if (i < 2) {
							names.push(item.deptName);
							i++;
						}
					});
					this[type + 'Name'] = names.join(',') + '等' + e.length + '个';
				}
				this[type + 'Show'] = false;
			},
			treeCancel(e, type) {
				this[type + 'Show'] = false;
			},
		}
	};
</script>
<style>
	page {
		background-color: #fff;
	}
</style>

<style lang="scss">
	.detail-view {
		background-color: #fff;
	}

	.detail-info {
		padding: 0;

		.overflow {
			padding: 20rpx 30rpx 0;
		}
	}

	.site-box {
		padding: 30rpx 30rpx 0;
		background-color: #f5f7fa;
	}

	.node {
		margin: 20rpx 0 0 20rpx;
		font-size: 14px;
		color: #9b9b9b;
		line-height: 120rpx;
	}

	.sched-box {
		padding: 10rpx 50rpx;
	}

	.form-box {
		.form-item {
			@include mp-flex;
			// border-bottom: 20rpx solid $u-border-color;

			.input-text {
				padding: 11rpx 0;
				line-height: 48rpx;
				text-align: right;
			}

			.text-l {
				width: 100%;
				white-space: pre-line;
				text-align: left;
			}
		}
	}

	.filter-box {
		position: fixed;
		left: 0;
		bottom: 0;
		right: 0;
		z-index: 998;
		background-color: #fff;
	}

	.fiexd-btm {
		position: static;
		padding: 30rpx;
	}

	.desc-content {
		padding: 10rpx 46rpx 22rpx;
		font-size: 32rpx;
		font-family: PingFang-SC-Medium, PingFang-SC;
		font-weight: 500;
		color: #333333;
		line-height: 60rpx;
	}

	.line-item2 {
		width: 100%;
		height: 20rpx;
		background: #F6F7FB;

	}



	.deal-type-box {
		width: 100%;
		height: 120rpx;
		background: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
	}

	.text-area-box {
		padding: 18rpx 46rpx 0;
		font-size: 34rpx;

	}

	.common-title {
		font-size: 32rpx;
		font-family: PingFang-SC-Medium, PingFang-SC;
		font-weight: 500;
		color: #333333;
		line-height: 44rpx;
		padding-left: 46rpx;
		margin-top: 30rpx;
		margin-bottom: 20rpx;
	}

	.title-view-box {
		width: 100%;
		display: flex;
		align-items: center;
		height: 100rpx;
		font-size: 34rpx;
		padding-left: 46rpx;
		font-family: PingFangSC-Semibold, PingFang SC;
		font-weight: 600;
		color: #333333;
		line-height: 48rpx;
		border-bottom: 2rpx solid #F6F7FB;
	}

	.coOrganizer-box {
		padding: 0 46rpx 20rpx;
		box-sizing: border-box;
	}
</style>